//
//  MainViewData.m
//  V3d_Cocoa
//
//  Created by Y my on 11-3-14.
//  Copyright 2011 NJUST. All rights reserved.
//

#import "MainViewData.h"


@implementation MainViewData

@synthesize ctype;
@synthesize curFocusXratio, curFocusYratio, curFocusZratio;
@synthesize bDrawFocusCrossLine, flagImgValScaleDisplay;
@synthesize xzoom_scale, yzoom_scale, zzoom_scale;
@synthesize xytranslation, xztranslation, yztranslation;

- (id)init {
	self = [super init];
	if (self) {
		ctype = colorUnknown;
		curFocusXratio = 0.5;
		curFocusYratio = 0.5;
		curFocusZratio = 0.5;
		bDrawFocusCrossLine = NO;
		flagImgValScaleDisplay = NO;
		xzoom_scale = 1;
		yzoom_scale = 1;
		zzoom_scale = 1;
		xytranslation = CGPointMake(0, 0);
		xztranslation = CGPointMake(0, 0);
		yztranslation = CGPointMake(0, 0);
	}
	return self;
}

- (void)setCtype:(ImageDisplayColorType)ct {
	ctype = ct;
	[self notify];
}

- (void)setCurFocusXratio:(CGFloat)x {
	curFocusXratio = x;
	[self notify];
}

- (void)setCurFocusYratio:(CGFloat)y {
	curFocusYratio = y;
	[self notify];
}

- (void)setCurFocusZratio:(CGFloat)z {
	curFocusZratio = z;
	[self notify];
}

- (void)setBDrawFocusCrossLine:(BOOL)b {
	bDrawFocusCrossLine = b;
	[self notify];
}

- (void)setFlagImgValScaleDisplay:(BOOL)b {
	flagImgValScaleDisplay = b;
	[self notify];
}

- (BOOL)scaleIsValid:(CGFloat)scale{
	return scale>0;
}

#define DEFAULT_SCALE 1;
- (CGFloat)xzoom_scale{
	return [self scaleIsValid:xzoom_scale] ? xzoom_scale : DEFAULT_SCALE;
}
- (void)setXzoom_scale:(CGFloat)scale
{
	if([self scaleIsValid:scale]){
		if(xzoom_scale != scale){
			xzoom_scale = scale;
			[self notify];
		}
	}
}
- (CGFloat)yzoom_scale{
	return [self scaleIsValid:yzoom_scale] ? yzoom_scale : DEFAULT_SCALE;
}
- (void)setYzoom_scale:(CGFloat)scale
{
	if([self scaleIsValid:scale]){
		if(yzoom_scale != scale){
			yzoom_scale = scale;
			[self notify];
		}
	}
}
- (CGFloat)zzoom_scale{
	return [self scaleIsValid:zzoom_scale] ? zzoom_scale : DEFAULT_SCALE;
}
- (void)setZzoom_scale:(CGFloat)scale
{
	if([self scaleIsValid:scale]){
		if(zzoom_scale != scale){
			zzoom_scale = scale;
			[self notify];
		}
	}
}

- (CGPoint)xytranslation
{
	return xytranslation;
}
- (void)setXytranslation:(CGPoint)newtranslation
{
		xytranslation.x += newtranslation.x;
		xytranslation.y += newtranslation.y;	
		//[self notify];

}

- (void)setXytranslationX:(CGFloat)newx
{
	xytranslation.x = newx;
}

- (void)setXytranslationY:(CGFloat)newy
{
	xytranslation.y = newy;
}

- (CGPoint)xztranslation
{
	return xztranslation;
}
- (void)setXztranslation:(CGPoint)newtranslation
{
	xztranslation.x += newtranslation.x;
	xztranslation.y += newtranslation.y;	
	//[self notify];
	
}

- (void)setXztranslationX:(CGFloat)newx
{
	xztranslation.x = newx;
}

- (void)setXztranslationY:(CGFloat)newy
{
	xztranslation.y = newy;
}

- (CGPoint)yztranslation
{
	return yztranslation;
}
- (void)setYztranslation:(CGPoint)newtranslation
{
	yztranslation.x += newtranslation.x;
	yztranslation.y += newtranslation.y;	
	//[self notify];
	
}

- (void)setYztranslationX:(CGFloat)newx
{
	yztranslation.x = newx;
}

- (void)setYztranslationY:(CGFloat)newy
{
	yztranslation.y = newy;
}
@end
